<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once('admin.php');

$title = __('Configuration', 'lp');
$this_file = 'lightpress/wp-plugin/config.php';
$parent_file = 'lightpress/wp-plugin/main.php';

$submenu[$this_file][] = array(
    __('LightPress', 'lp'),
    6,
    'lightpress/wp-plugin/main.php',
    __('LightPress', 'lp')
    );

require_once 'LightPressOptions.php';

$lp_opts = new LightPressOptions();

$noheader = isset($_GET['noheader']);

if ($noheader) {
    header('Content-Type: text/plain');
    header('Content-Disposition: attachment; filename=config.php');
    echo $lp_opts->getConfig();
    exit();
}
?>

<style type="text/css">
h3 { margin: 0px; margin-top: 12px; margin-bottom: 6px; }
caption { font-weight: bold; text-align: center; }
label { font-weight: bold; }
small { font-size: 0.9em; font-style: italic; color: #666; }
pre { border: solid 1px #999; }
code { color: #333366; font-style: italic; }
code.opt { font-weight: bold; font-style: normal; }
.error { color: #993333; }
.warning { color: #cc33cc; }
</style>

<div class="wrap"> 
<h2><?php _e('LightPress Configuration', 'lp'); ?></h2>
<p><?php printf(__('Copy the following lines and paste them into a file named <code>%s</code> on your webserver.', 'lp'), dirname(dirname(__FILE__)).'/config.php'); ?></p>
<p><?php printf(__('You can also <a href="%s" title="download the configuration file">download</a> the <code>config.php</code> file ready to be copied to your server\s folder.', 'lp'), $_SERVER['REQUEST_URI'].'&noheader=1'); ?></p>
<code><pre class="php">
<?php
echo htmlentities($lp_opts->getConfig());
?>
</pre></code>
</div>
